package testeJSF3.bean;

import java.util.ArrayList;
import java.util.List;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

import testeJSF3.model.AreaInteresse;

@ManagedBean(name="mb")  
@SessionScoped  
public class BeanAreaInteresse {  
		private AreaInteresse a;  
		private List<AreaInteresse>lista;  
	     
	   public BeanAreaInteresse() {  
	      a = new AreaInteresse();  
	   }  
	  
	   

	   public AreaInteresse getA() {
		return a;
	}



	public void setA(AreaInteresse a) {
		this.a = a;
	}



	public List<AreaInteresse> getLista() {
		return lista;
	}



	public void setLista(List<AreaInteresse> lista) {
		this.lista = lista;
	}



	public String enviarDados(){  
	      if(lista == null) lista = new ArrayList<AreaInteresse>();  
	      lista.add(a);  
	      a = new AreaInteresse();  
	      FacesContext.getCurrentInstance().addMessage("frmInteresse", new FacesMessage("Gravado com sucesso!"));  
	      return null;  
	   } 
}
